//
//  InterestDetailTableViewCell.m
//  ZYZB
//
//  Created by ENERGY on 2018/7/10.
//  Copyright © 2018年 ENERGY. All rights reserved.
//

#import "InterestDetailTableViewCell.h"

@interface InterestDetailTableViewCell()
@property (nonatomic, strong)UILabel * timeLab;
@property (nonatomic, strong)UILabel * accountLab;
@property (nonatomic, strong)UILabel * stateLab;
@end

@implementation InterestDetailTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        __weak typeof (self)weakSelf = self;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:self.timeLab];
        [self.contentView addSubview:self.accountLab];
        [self.contentView addSubview:self.stateLab];
        UIView * lineView = [[UIView alloc] init];
        lineView.backgroundColor = getColor(borderColor);
        [self.contentView addSubview:lineView];
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(weakSelf.contentView);
            make.height.mas_offset(1/WIDTH_6_SCALE);
            make.left.equalTo(weakSelf.contentView.mas_left).mas_offset(18/WIDTH_6_SCALE);
            make.right.equalTo(weakSelf.contentView.mas_right).mas_offset(-18/WIDTH_6_SCALE);
        }];
        [self.timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(lineView);
            make.left.equalTo(weakSelf.contentView.mas_left).mas_offset(18/WIDTH_6_SCALE);
            make.top.equalTo(weakSelf.contentView);
        }];
        [self.accountLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.contentView.mas_left).mas_offset(SCREEN_WIDTH/3);
            make.top.centerY.equalTo(weakSelf.timeLab);
            make.width.mas_offset(SCREEN_WIDTH/3);
        }];
        [self.stateLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(lineView);
            make.right.equalTo(weakSelf.contentView.mas_right).mas_offset(-18/WIDTH_6_SCALE);
            make.top.width.equalTo(weakSelf.accountLab);
        }];
    }return self;
}

- (UILabel *)timeLab{
    if (!_timeLab) {
        _timeLab = [[UILabel alloc] init];
        _timeLab.font = DEF_FontSize_10;
        _timeLab.textColor = [UIColor blackColor];
        _timeLab.textAlignment = NSTextAlignmentLeft;
        _timeLab.text = @"2018-01-01";
    }return _timeLab;
}
- (UILabel *)accountLab{
    if (!_accountLab) {
        _accountLab = [[UILabel alloc] init];
        _accountLab.font = DEF_FontSize_12;
        _accountLab.textColor = [UIColor orangeColor];
        _accountLab.textAlignment = NSTextAlignmentCenter;
        _accountLab.text = @"1.36元";
    }return _accountLab;
}
- (UILabel *)stateLab{
    if (!_stateLab) {
        _stateLab = [[UILabel alloc] init];
        _stateLab.font = DEF_FontSize_12;
        _stateLab.textColor = getColor(@"3675bd");
        _stateLab.textAlignment = NSTextAlignmentRight;
        _stateLab.text = @"已还款";
    }return _stateLab;
}

- (void)setModel:(NSDictionary *)model{
    _model = model;
    self.timeLab.text = model[@""];
    self.accountLab.text = model[@""];
    self.stateLab.text = model[@""];
}

- (void)setLendRecordModel:(NSDictionary *)lendRecordModel{
    _lendRecordModel = lendRecordModel;
    self.timeLab.text = lendRecordModel[@""];
    self.timeLab.textColor = [UIColor blackColor];
    self.accountLab.text = lendRecordModel[@""];
    self.accountLab.textColor = [UIColor blackColor];
    self.stateLab.text = lendRecordModel[@""];
    self.stateLab.textColor = getColor(@"3675bd");
}
@end
